<template>
  <div>
    <div id="RadarChart" :style="style"/>
  </div>
</template>

<script>
import * as echarts from 'echarts';
export default {
  name: "radarChart",
  data() {
    return {
      style: {width: '100%', height: '100%'}
    }
  },
  mounted() {
    this.RadarChartInit()
  },
  methods: {
    RadarChartInit(){
      const chartDom = document.getElementById('RadarChart');
      const myChart = echarts.init(chartDom);
      let option;

      option = {
        title: {
          text: '天气指标数据'
        },
        legend: {
          data: ['昨日数据天气指标', '今日数据天气指标'],
          bottom: 10
        },
        radar: {
          // shape: 'circle',
          indicator: [
            { name: '最高温度', max: 6500 },
            { name: '最低温度', max: 16000 },
            { name: '空气湿度', max: 30000 },
            { name: '空气质量', max: 38000 },
            { name: '紫外线强度', max: 52000 },
            { name: '风力等级', max: 25000 }
          ]
        },
        series: [
          {
            name: 'Budget vs spending',
            type: 'radar',
            data: [
              {
                value: [4200, 3000, 20000, 35000, 50000, 18000],
                name: '昨日数据天气指标'
              },
              {
                value: [5000, 14000, 28000, 26000, 42000, 21000],
                name: '今日数据天气指标'
              }
            ]
          }
        ]
      };

      option && myChart.setOption(option);
    }
  }
}
</script>

<style scoped>

</style>
